-
Notifications
You must be signed in to change notification settings - Fork 4.3k
.Net: feat: Modernize BingTextSearch connector with ITextSearch<TRecord> interface (microsoft#10456) #13188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
alzarei
wants to merge
5
commits into
microsoft:feature-text-search-linq
Choose a base branch
from
alzarei:feature-text-search-linq-pr3
base: feature-text-search-linq
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
.Net: feat: Modernize BingTextSearch connector with ITextSearch<TRecord> interface (microsoft#10456) #13188
alzarei
wants to merge
5
commits into
microsoft:feature-text-search-linq
from
alzarei:feature-text-search-linq-pr3
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…extSearch Implement ITextSearch<BingWebPage> alongside existing ITextSearch interface Add LINQ expression conversion logic with property mapping to Bing API parameters Support type-safe filtering with BingWebPage properties Provide graceful degradation for unsupported LINQ expressions Maintain 100% backward compatibility with existing legacy interface Addresses microsoft#10456 Part of PR 3/6 in structured modernization of ITextSearch interfaces
5d56fac
to
3d5cd1a
Compare
- Implement equality (==), inequality (!=), Contains(), and AND (&&) operators - Map LINQ expressions to Bing Web Search API advanced operators - Support negation syntax for inequality (-operator:value) - Maintain full backward compatibility Addresses microsoft#10456 Aligns with PR microsoft#10273 Tests: 38/38 pass (100%) Breaking changes: None
westey-m
requested changes
Oct 13, 2025
} | ||
|
||
/// <inheritdoc/> | ||
Task<KernelSearchResults<string>> ITextSearch<BingWebPage>.SearchAsync(string query, TextSearchOptions<BingWebPage>? searchOptions, CancellationToken cancellationToken) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should add some unit tests for the new methods.
Should be similar to the ones already in BingTextSearchTests.
Looks good otherwise.
- Added 9 semantic verification tests for LINQ filter translation - Tests verify correct Bing API query parameter generation - Fixed inequality operator bug discovered during testing - Addresses reviewer feedback on PR microsoft#13188
…y test - ProcessEqualityExpression now handles Convert expressions for nullable types (bool?) - Added explicit boolean-to-lowercase string conversion for Bing API compatibility - Added test for IsFamilyFriendly == true filter (validates safeSearch query parameter) - Achieves 100% coverage of all 10 LINQ filter operations - Note: CA1308 warning acceptable - Bing API requires lowercase boolean strings
- Add pragma directive to suppress CA1308 warning with proper rationale - Bing API specifically expects lowercase boolean values (true/false) - ToLowerInvariant() is the correct choice for this API compatibility requirement - All builds now clean with 0 warnings, tests continue to pass (48/48)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Modernize BingTextSearch connector with ITextSearch interface
Problem Statement
The BingTextSearch connector currently only implements the legacy ITextSearch interface, forcing users to use clause-based TextSearchFilter instead of modern type-safe LINQ expressions. This creates runtime errors from property name typos and lacks compile-time validation.
Technical Approach
This PR modernizes the BingTextSearch connector to implement the generic ITextSearch interface alongside the existing legacy interface. The implementation provides recursive expression tree processing to convert LINQ patterns into Bing Web Search API advanced operators.
Implementation Details
Core Changes
Expression Tree Processing
Code Examples
Before (Legacy Interface)
After (Generic Interface)
Implementation Benefits
Type Safety & Developer Experience
Enhanced Filtering Capabilities
Validation Results
Build Verification
dotnet build --configuration Release
dotnet build src/Plugins/Plugins.Web/Plugins.Web.csproj --configuration Release
Test Coverage
Code Quality
dotnet format SK-dotnet.slnx --verify-no-changes
- 0 files needed formattingFiles Modified
Breaking Changes
None. All existing BingTextSearch functionality preserved with zero regressions.
Multi-PR Context
This is PR 3 of 6 in the structured implementation approach for Issue #10456. This PR extends LINQ filtering support to the BingTextSearch connector while maintaining independence from other connector modernization efforts.